#include "toy/ToyDialect.h"
#include "toy/ToyOps.h"

#include "toy/ToyDialect.cpp.inc"
#define GET_OP_CLASSES
#include "toy/Toy.cpp.inc"

using namespace mlir;
using namespace toy;

void ToyDialect::initialize() {
  addOperations<
#define GET_OP_LIST
#include "toy/Toy.cpp.inc"
  >();
}

/*
void AddOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
                  mlir::Value lhs, mlir::Value rhs) {
  state.addTypes(builder.getI32Type());
  state.addOperands({lhs, rhs});
}
*/

void AddOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
                  mlir::ValueRange inputs) {
  state.addTypes(builder.getI32Type());
  state.addOperands({inputs[0], inputs[1]});
}
